﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BI.CF.Factory;
using BI.CF.PageList;
using BI.CF.IDAL;
using BI.CF.Model;

namespace BI.CF.BLL
{
    public  class Invest_BLL
    {
       static CF_Factory fac = CF_Factory.DataBaseType();
       InvestIDAL servicefac = fac.InvestIDAL_Factory();
       /// <summary>
       /// 显示+搜索+分页（我要投资）
       /// </summary>
       /// <param name="pageindex">当前页</param>
       /// <param name="pagesize">当前页显示条数</param>
       /// <param name="huankuantype">还款方式</param>
       /// <param name="jiekuandaystar">借款期限的开始天数</param>
       /// <param name="jiekuandayend">借款期限的结束天数</param>
       /// <param name="biaotype">标的类型</param>
       /// <param name="paixu">结果的排序</param>
       /// <returns></returns>
       public Pager<MemLoanModel> Invest_Show(int pageindex, int pagesize, string huankuantype, int jiekuandaystar, int jiekuandayend, string biaotype, string paixu)
       {
           return servicefac.Invest_Show(pageindex, pagesize, huankuantype, jiekuandaystar, jiekuandayend, biaotype, paixu);
       }
       /// <summary>
       /// 通过memtable查询user表里面的userid
       /// </summary>
       /// <param name="id"></param>
       /// <returns></returns>
       public UserrsModel Mem_select_User_ID(int id)
       {
           return servicefac.Mem_select_User_ID(id);
       }
       /// <summary>
       /// 进行投资的详情
       /// </summary>
       /// <returns></returns>
       public MemLoanModel Memloan_Show_XiangQing(int memid)
       {
           return servicefac.Memloan_Show_XiangQing(memid);
       }
       /// <summary>
       /// 得出用户财产
       /// </summary>
       /// <param name="userid"></param>
       /// <returns></returns>
       public MemPropertyModel Memloan_Show_Memproperty(int userid)
       {
           return servicefac.Memloan_Show_Memproperty(userid);
       }
       /// <summary>
       /// 进行投资添加
       /// </summary>
       /// <param name="UserID"></param>
       /// <param name="TouZiMoney"></param>
       /// <param name="TouZiLiXi"></param>
       /// <param name="TouZiStarTime"></param>
       /// <param name="MemLoanID"></param>
       /// <returns></returns>
       public bool TouZi_Geting(int UserID, decimal TouZiMoney, string TouZiLiXi, string TouZiStarTime, int MemLoanID)
       {
           return servicefac.TouZi_Geting(UserID, TouZiMoney, TouZiLiXi, TouZiStarTime, MemLoanID);
       }
       /// <summary>
        /// 查询投资人的账户是否满足投资金额
        /// </summary>
        /// <param name="userid">投资人ID</param>
        /// <returns></returns>
        public decimal AvailableBalance(int userid)
        {
            return servicefac.AvailableBalance(userid);
        }
    }
}
